<ul>
	{if(isset($address_list) && is_array($address_list))}
	{volist name='address_list' key='key' id='val'}
    <li class="receive_add address_item ncc-selected-item">
    <input address="{$val.area_info|default=''}&nbsp;{$val.address|default=''}" true_name="{$val.true_name}" id="addr_{$val.address_id}" nc_type="addr" type="radio" class="radio" city_id="{$val.city_id|default=0}" area_id={$val.area_id|default=0} name="addr" value="{$val.address_id}" phone="{$val.mob_phone|default=''}{if($val.mob_phone && $val.tel_phone)}/{/if}{$val.tel_phone|default=''}"  />
    <label for="addr_{$val.address_id}"><span class="true-name">{$val.true_name}</span><span class="address">{$val.area_info|default=''}&nbsp;{$val.address|default=''}</span><span class="phone"><i class="icon-mobile-phone"></i>{$val.mob_phone|default=''}{if($val.mob_phone && $val.tel_phone)}/{/if}{$val.tel_phone|default=''}</span></label>
    <a href="javascript:void(0);" onclick="delAddr({$val.address_id|default=0});" class="del">[ 删除 ]</a> </li>
    {/volist}
    {/if}
    <li class="receive_add addr_item">
    <input value="0" nc_type="addr" id="add_addr" type="radio" name="addr">
    <label for="add_addr">使用新地址</label>
      </li>
  <div id="add_addr_box"></div>
</ul>
<div class="hr16"> <a id="hide_addr_list" class="new_btn new_blue_btn" href="javascript:void(0);">保存收货人信息</a></div>
<script type="text/javascript">
function delAddr(id){
    $('#addr_list').load(SITEURL+'/index.php?s=member/buy/load_addr&id='+id);
}
$(function(){
    function addAddr() {
        $('#add_addr_box').load(SITEURL+'/index.php?s=member/buy/add_addr');
    }
    $('input[nc_type="addr"]').on('click',function(){
        if ($(this).val() == '0') {
            $('.address_item').removeClass('ncc-selected-item');
            $('#add_addr_box').load(SITEURL+'/index.php?s=member/buy/add_addr');
        } else {
            $('.address_item').removeClass('ncc-selected-item');
            $(this).parent().addClass('ncc-selected-item');
            $('#add_addr_box').html('');
        }
    });
    $('#hide_addr_list').on('click',function(){
        if ($('input[nc_type="addr"]:checked').val() == '0'){
            submitAddAddr();
        } else {
            if ($('input[nc_type="addr"]:checked').size() == 0) {
                return false;
            }
            var city_id = $('input[name="addr"]:checked').attr('city_id');
            var area_id = $('input[name="addr"]:checked').attr('area_id');
            var addr_id = $('input[name="addr"]:checked').val();
            var true_name = $('input[name="addr"]:checked').attr('true_name');
            var address = $('input[name="addr"]:checked').attr('address');
            var phone = $('input[name="addr"]:checked').attr('phone');
            showShippingPrice(city_id,area_id);
            hideAddrList(addr_id,true_name,address,phone);
        }
    });
    if ($('input[nc_type="addr"]').size() == 1){
        $('#add_addr').attr('checked',true);
        addAddr();
    }
});
</script>